﻿@inherits BlazorStrap.Shared.Components.Common.BSAccordionItemBase
@namespace BlazorStrap.V5

@if (Header == null || Content == null)
{
    <BlazorStrap.InternalComponents.Error Name="BSAccordionItem">
        Both <strong>Header</strong> and <strong>Content</strong> RenderFragment are required.
    </BlazorStrap.InternalComponents.Error>

    return;
}
<CascadingValue Value="this">
<div class="accordion-item">
    <h2 class="@HeaderClassBuilder">
            <button type="button" aria-expanded="@Shown.ToString().ToLower()" data-bs-toggle="collapse" class="accordion-button @(Shown ? "" : "collapsed")" @onclick="EventUtil.AsNonRenderingEventHandler(ToggleAsync)" @ref="ButtonRef" data-blazorstrap-target="@DataId">@Header</button>
    </h2>
    <div class="@ClassBuilder" style="@StyleBuilder" @ref="MyRef" data-blazorstrap="@DataId">
        <div class="@ContentClassBuilder">
            @Content
        </div>
    </div>
</div>
</CascadingValue>